﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class bbsdetail : System.Web.UI.Page
{
    private DataTable bbsGetReCal(int pagestart, int pagesize,string fid)
    {
        MysqlHelp bbsdata = new MysqlHelp();
        string conn = "select * from bbs where parent='"+fid+"'order by time DESC limit " + pagestart + "," + pagesize;
        DataTable recall = bbsdata.GetDatabysql(conn);
        return recall;
    }
    private DataTable bbsGetVal(string fid)
    {
        MysqlHelp bbsdata = new MysqlHelp();
        string conn = "select * from bbs where id='" + fid + "'";
        DataTable ret = bbsdata.GetDatabysql(conn);
        return ret;
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        string bbsid = Request["id"];
        DataTable bbsreply,bbstitl;
        bbstitl=bbsGetVal(bbsid);
        bbsreply=bbsGetReCal(0,10,bbsid);
        Response.Write(string.Format("<table><td id=\"replyno\">共有{0}回复</td></table></br>", bbsreply.Rows.Count));
        Response.Write(string.Format("<table><th id=\"detailtitle\" >{0}</th></table></br>", bbstitl.Rows[0]["title"]));
        Response.Write(string.Format("<div id=\"bbsleft\" class=\"navigation\"> 作者:</br>{0}</div><div id=\"bbsbody\" class=\"modulebody\">{1}</div>", bbstitl.Rows[0]["username"], bbstitl.Rows[0]["content"]));
        int i;
         for(i=0;i<bbsreply.Rows.Count;i++)
             Response.Write(string.Format("<div class=\"navigation\"> 回复者：{0}</br><img src=\"Zombatar_1.jpg\"></div><div class=\"modulebody\">{1}</div>", bbsreply.Rows[i]["username"], bbsreply.Rows[i]["content"]));
    }
}
